
package view;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;



public class Board extends Composite{
	
int[][] boardData; // the data of the board
int size;

public Board(Composite parent, int style) {
	super(parent, style);
	size=4;
	boardData=new int [size][size];
	setLayout(new GridLayout(size,true));
	
	Tile tiles[][]= new Tile[size][size];
	
	boardData[0][0]=2048;
	boardData[0][1]=1024;
	boardData[0][2]=512;
	boardData[0][3]=256;
	boardData[1][0]=128;
	boardData[1][1]=2048;
	boardData[1][2]=2048;
	boardData[1][3]=2048;
	boardData[2][0]=2048;
	boardData[2][1]=2048;
	boardData[2][2]=2048;
	
	for (int i=0; i<size; i++){
		for (int j=0; j<size; j++){
			tiles[i][j] = new Tile(this,SWT.BORDER);
			tiles[i][j].setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
			tiles[i][j].setValue(boardData[i][j]);
		}
	}
}}